home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / dp_srccs / trainer.asm < prev    next >
Encoding:
Assembly Source File  |  1996-12-08  |  29.0 KB  |  1,035 lines

  1. ────────────────────────────────────────────────────────────────────────────────
  2. ; plasmoid/deep 1994:
  3. ; well, sure you don't know that wilkins is now going to make trainers
  4. ; in fact his missing knowledge in coding allows him just to find some
  5. ; interesting adresses...who has to code the trainer? me plasmoid, and
  6. ; here he is: the universal tainer code menu.
  7. ; if you modify anything on diz code, remember ds is always cs, if you
  8. ; change it, you have to restore it afterwards!
  9. ────────────────────────────────────────────────────────────────────────────────
  10. .286
  11. .model tiny
  12. code            segment
  13.         locals
  14.         assume  cs:code
  15.         org     100h
  16. trainer:        jmp     main
  17. db  " · code by plasmoid · trained by wilkins · soundsystem by psi · "
  18. ────────────────────────────────────────────────────────────────────────────────
  19. shades          proc
  20.         mov     dx,0a000h
  21.         mov     es,dx
  22.         mov     ax,x1_direct
  23.         mov     di,y2_direct
  24.         add     ax,x1_point
  25.  
  26.         mov     bx,y1_point
  27.         mov     si,x2_point
  28.         cmp     delay,02
  29.         jb      @jump
  30.         mov     bx,y1_direct
  31.         mov     si,x2_direct
  32.         add     bx,y1_point
  33.         add     si,x2_point
  34.         mov     delay,00
  35.  
  36. @jump:          add     di,y2_point
  37.         inc     delay
  38.         mov     x1_point,ax
  39.         mov     y1_point,bx
  40.         mov     x2_point,si
  41.         mov     y2_point,di
  42.         cmp word ptr x1_point,319
  43.         jae     x1_down
  44.         cmp word ptr x1_point,1
  45.         jbe     x1_up
  46.         cmp word ptr x2_point,319
  47.         jae     x2_down
  48.         cmp word ptr x2_point,1
  49.         jbe     x2_up
  50.         cmp word ptr y1_point,199
  51.         jae     y1_left
  52.         cmp word ptr y1_point,1
  53.         jbe     y1_right
  54.         cmp word ptr y2_point,199
  55.         jae     y2_left
  56.         cmp word ptr y2_point,1
  57.         jbe     y2_right
  58.         call    line
  59.         ret
  60. x1_down:        mov     x1_direct,-1
  61.         ret
  62. x1_up:          mov     x1_direct, 1
  63.         ret
  64. x2_down:        mov     x2_direct,-1
  65.         ret
  66. x2_up:          mov     x2_direct, 1
  67.         ret
  68. y1_left:        mov     y1_direct,-1
  69.         ret
  70. y1_right:       mov     y1_direct, 1
  71.         ret
  72. y2_left:        mov     y2_direct,-1
  73.         ret
  74. y2_right:       mov     y2_direct, 1
  75.         ret
  76.  
  77. x1_point        dw      30
  78. x1_direct       dw      1
  79. y1_point        dw      32
  80. y1_direct       dw      1
  81. x2_point        dw      141
  82. x2_direct       dw      1
  83. y2_point        dw      149
  84. y2_direct       dw      1
  85. delay           db      00
  86. shades          endp
  87. ────────────────────────────────────────────────────────────────────────────────
  88. pixel           proc near
  89.         push    dx                      ; ∙ ax-x bx-y
  90.         push    bx
  91.         push    ax
  92.         mov     dx,ax                   ; ∙ multis y * 320
  93.         shl     dx,8                    ;   using    * 256
  94.         shl     ax,6                    ;   using    *  64
  95.         add     ax,dx                   ;            = 320
  96.         add     bx,ax                   ; ∙ add y to x
  97.         cmp     byte ptr es:[bx],31+19
  98.         jae     @okay
  99.         cmp     byte ptr es:[bx],19
  100.         jb      @okay
  101. @inc:           inc     byte ptr es:[bx]        ; ∙ mov it!
  102. @okay:          pop     ax
  103.         pop     bx
  104.         pop     dx
  105.         ret
  106. pixel           endp
  107. ────────────────────────────────────────────────────────────────────────────────
  108. line            proc near
  109.         s1      equ [bp-10h]            ; ∙ ax-x bx-y
  110.         s2      equ [bp-0eh]            ; ∙ si-x bx-y
  111.         s3      equ [bp-0ch]
  112.         s4      equ [bp-0ah]
  113.         x1      equ [bp-08h]
  114.         y1      equ [bp-06h]
  115.         x2      equ [bp-04h]
  116.         y2      equ [bp-02h]
  117.  
  118.         enter   10h,0
  119.         mov     x1,ax                   ; ∙ here cum some nice
  120.         mov     y1,bx                   ;   explaining words
  121.         mov     x2,si
  122.         mov     y2,di
  123.         mov     si,x2                   ; ∙ checks if sign
  124.         sub     si,x1                   ;   meaning if  or 
  125.         jns     @lab1
  126.         neg     si                      ; ∙ change sign
  127. @lab1:          mov     di,y2                   ; ∙ checks if sign
  128.         sub     di,y1                   ;   meaning if  or 
  129.         jns     @lab2
  130.         neg     di                      ; ∙ change sign
  131. @lab2:          cmp     si,di
  132.         jge     @lab3a                  ; ∙ m <= 1
  133.         jmp     @lab20                  ; ∙ m >  1
  134.  
  135. @lab3a:         mov     bx,x1                   ; ∙ checks if x1 <= x2
  136.         cmp     bx,x2
  137.         jg      @lab4
  138.         mov     bx,1                    ; ∙ go right!
  139.         jmp     @lab5
  140. @lab4:          mov     bx,-1                   ; ∙ go left!
  141. @lab5:          mov     ax,y1                   ; ∙ checks if y1 <= y2
  142.         cmp     ax,y2
  143.         jg      @lab6
  144.         mov     ax,1                    ; ∙ go up!
  145.         jmp     @lab7
  146.  
  147. @lab6:          mov     ax,-1                   ; ∙ go down!
  148. ; small comment: Going down, mayday, mayday (from Comanche)
  149. @lab7:          mov     s1,bx                   ; ∙ save m on stack
  150.         mov     s2,ax
  151.         add     di,di                   ; ∙ draw point
  152.         mov     s3,di
  153.         sub     di,si
  154.         mov     bx,di
  155.         sub     bx,si
  156.         mov     s4,bx
  157.         mov     bx,x1
  158.         mov     ax,y1
  159.         call    pixel
  160.  
  161. @lab8:          cmp     bx,x2                   ; ∙ points left?
  162.         jz      @lab3
  163.         add     bx,s1                   ; ∙ increases x
  164.         or      di,di                   ; ∙ checks if y should
  165.         jns     @lab10                  ;   be increased
  166.         add     di,s3
  167.         jmp     @lab11
  168. @lab10:         add     di,s4                   ; ∙ next point
  169.         add     ax,s2
  170. @lab11:         call    pixel
  171.         jmp     @lab8
  172.  
  173. @lab20:         mov     bx,y1                   ; ∙ checks if y1 <= y2
  174.         cmp     bx,y2
  175.         jg      @lab12
  176.         mov     bx,1                    ; ∙ go up!
  177.         jmp     @lab13
  178.  
  179. @lab12:         mov     bx,-1                   ; ∙ go down!
  180. ; small comment: Going down, mayday, mayday (from Comanche)
  181. @lab13:         mov     ax,x1                   ; ∙ checks if x1 <= x2
  182.         cmp     ax,x2
  183.         jg      @lab14
  184.         mov     ax,1                    ; ∙ go right!
  185.         jmp     @lab15
  186. @lab14:         mov     ax,-1                   ; ∙ go left!
  187. @lab15:         mov     s1,bx                   ; ∙ save m on stack
  188.         mov     s2,ax
  189.         add     si,si                   ; ∙ draw point
  190.         mov     s3,si
  191.         sub     si,di
  192.         mov     bx,si
  193.         sub     bx,di
  194.         mov     s4,bx
  195.         mov     di,si
  196.         mov     bx,x1
  197.         mov     ax,y1
  198.         call    pixel
  199. @lab16:         cmp     ax,y2                   ; ∙ points left?
  200.         jz      @lab3
  201.         add     ax,s1                   ; ∙ increases x
  202.         or      di,di                   ; ∙ checks if y should
  203.         jns     @lab18                  ;   be increased
  204.         add     di,s3
  205.         jmp     @lab19
  206. @lab18:         add     di,s4                   ; ∙ next point
  207.         add     bx,s2
  208. @lab19:         call    pixel
  209.         jmp     @lab16
  210.  
  211. @lab3:          leave
  212.         ret
  213. line            endp
  214. ────────────────────────────────────────────────────────────────────────────────
  215. fill            proc
  216.         mov     dx,0a000h
  217.         mov     es,dx
  218.         xor     di,di
  219.         mov     cx,320*200
  220. @@f2:           cmp byte ptr es:[di],00
  221.         jne     @@f1
  222.         mov byte ptr es:[di],19
  223. @@f1:           inc     di
  224.         loop    @@f2
  225.         ret
  226. fill            endp
  227. ────────────────────────────────────────────────────────────────────────────────
  228. ; diz is the original future crew simplex adlib player, which i ripped
  229. ; out of the sp2.com source. anyway, thousands of thanks fly to future
  230. ; crew for diz tiny code, it's pretty cool...
  231. ────────────────────────────────────────────────────────────────────────────────
  232. a_lodsboutaw03: call    a_lodsboutaw            ; ∙ out data to adlib
  233.         add     ah,3
  234. a_lodsboutaw:   lodsb
  235. a_outaw         proc near                       ; ∙ ah=reg,al=data
  236.         push    ax
  237.         push    cx
  238.         xchg    al,ah
  239.         mov     dx,388h
  240.         out     dx,al
  241.         mov     cx,7
  242.         call    a_wait
  243.         mov     dx,389h
  244.         mov     al,ah
  245.         out     dx,al
  246.         mov     cx,30
  247.         call    a_wait
  248.         pop     cx
  249.         pop     ax
  250.         ret
  251. a_wait:         in      al,dx
  252.         loop    a_wait
  253.         ret
  254. a_outaw         endp
  255. ────────────────────────────────────────────────────────────────────────────────
  256. a_loadinstrument proc near      ; ∙ bx=channel, ds:si=offset to instrument data
  257.         mov     ah,ds:a_inst_table[bx]
  258.         mov     cx,4
  259. @@1:            call    a_lodsboutaw03
  260.         add     ah,20h-3
  261.         loop    @@1
  262.         add     ah,40h
  263.         call    a_lodsboutaw03
  264.         mov     ah,bl
  265.         add     ah,0c0h
  266.         jmp     a_lodsboutaw
  267. a_loadinstrument endp
  268. ────────────────────────────────────────────────────────────────────────────────
  269. a_playnote      proc near               ; ∙ bx=channel, ax=data
  270.         push    bx
  271.         xchg    ah,bl
  272.         add     ah,0a0h
  273.         call    a_outaw
  274.         mov     al,bl
  275.         add     ah,010h
  276.         pop     bx
  277.         jmp     a_outaw
  278. a_playnote      endp
  279. ────────────────────────────────────────────────────────────────────────────────
  280. a_init          proc near
  281.         mov     ax,00120h
  282.         call    a_outaw
  283.         mov     ax,00800h
  284.         call    a_outaw
  285.         mov     ah,0bdh
  286.         call    a_outaw
  287.         mov     bp,9
  288.         xor     bx,bx
  289.         mov     di,offset music_instruments
  290. @@1:            mov     si,ds:[di]
  291.         add     di,2
  292.         call    a_loadinstrument
  293.         xor     ax,ax
  294.         call    a_playnote
  295.         inc     bx
  296.         dec     bp
  297.         jnz     @@1
  298.         ret
  299. a_init          endp
  300. ────────────────────────────────────────────────────────────────────────────────
  301. a_dorow         proc near                       ; ∙ play a row
  302.         push    ds
  303.         push    cs
  304.         pop     ds
  305.         sub     ds:a_musiccnt,1
  306.         jnc     @@0
  307.         mov     ds:a_musiccnt,music_speed
  308.         mov     cx,music_channels
  309.         mov     di,offset music_patterns
  310.         xor     bx,bx
  311. @@1:            sub     ds:a_chdelaycnt[bx],1
  312.         jns     @@2
  313.         mov     si,ds:[di]
  314.         xor     ax,ax
  315.         call    a_playnote
  316. @@4:            lodsb
  317.         or      al,al
  318.         jz      @@7
  319.         jns     @@6
  320.         sub     al,81h
  321.         mov     ds:a_chdelay[bx],al
  322.         lodsb
  323. @@6:            mov     dl,al
  324.         and     ax,15
  325.         mov     bp,ax
  326.         add     bp,bp
  327.         mov     ax,ds:a_note_table[bp]
  328.         shr     dl,2
  329.         and     dl,not 3
  330.         add     ah,dl
  331.         call    a_playnote
  332.         mov     al,ds:a_chdelay[bx]
  333.         mov     ds:a_chdelaycnt[bx],al
  334.         mov     ds:[di],si
  335. @@2:            add     di,4
  336.         inc     bx
  337.         loop    @@1
  338. @@0:            pop     ds
  339.         ret
  340. @@7:            mov     si,ds:[di+2]
  341.         jmp     @@4
  342. a_dorow         endp
  343. ────────────────────────────────────────────────────────────────────────────────
  344. timer           proc near
  345.         push    ax
  346.         mov     al,20h
  347.         out     20h,al
  348.         inc     cs:counter
  349.         inc     cs:wait70Hz
  350.         cmp     cs:wait70Hz,15
  351.         jb      no_wait70Hz
  352.         inc    cs:waitClock
  353.         cmp    cs:waitClock,4
  354.         jb    no_waitClock
  355.         mov    cs:waitClock,00
  356.         int    1ch
  357. no_waitClock:    mov     cs:wait70Hz,00
  358.         pusha
  359.         call    a_dorow
  360.         popa
  361. no_wait70Hz:    pop     ax
  362.         iret
  363. counter         dw      0000h
  364. wait70Hz        db      00h
  365. waitClock    db    00h
  366. timer           endp
  367. ────────────────────────────────────────────────────────────────────────────────
  368. init_timer      proc    near
  369.         xor     dx,dx                   ; ∙ rescue old int 8
  370.         mov     es,dx
  371.         mov     ax,es:[8*4]+0
  372.         mov     cs:oldint8[0],ax
  373.         mov     ax,es:[8*4]+2
  374.         mov     cs:oldint8[2],ax
  375.  
  376.         mov     dx,1193                 ; ∙ new freq 1000 hz
  377.  
  378.         cli
  379.         mov     ax,cs
  380.         mov     es:[8*4]+2,ax           ; ∙ set new int 8
  381.         mov     ax,offset timer
  382.         mov     es:[8*4]+0,ax
  383.  
  384. out_it:         mov     al,036h                 ; ∙ out these things, they
  385.         out     43h,al                  ;   just remain a secret
  386.         mov     al,dl                   ;   for me...
  387.         out     40h,al
  388.         mov     al,dh
  389.         out     40h,al
  390.         sti
  391.         ret
  392.  
  393. oldint8         dw 2 dup (?)
  394. init_timer      endp
  395. ────────────────────────────────────────────────────────────────────────────────
  396. kill_timer      proc near
  397.         xor     dx,dx
  398.         mov     es,dx
  399.         cli
  400.         mov     ax,cs:oldint8[0]        ; ∙ restore old setting
  401.         mov     es:[8*4]+0,ax
  402.         mov     ax,cs:oldint8[2]
  403.         mov     es:[8*4]+2,ax
  404.         jmp     out_it
  405. kill_timer      endp
  406. ────────────────────────────────────────────────────────────────────────────────
  407. rotate           proc near
  408.          mov    si,bp
  409.          mov    dx,08000h
  410.          mov    es,dx
  411.          xor    di,di
  412.          mov    cx,bx
  413.          rep    movsb
  414.  
  415. backward:        mov    ds,dx
  416.          push   cs
  417.          pop    es
  418.          mov    si,3
  419.          mov    di,bp
  420.          sub    bx,3
  421.          mov    cx,bx
  422.          add    bx,3
  423.          rep    movsb
  424.  
  425.          xor    si,si
  426.          mov    cx,3
  427.          rep    movsb
  428.          sub    bp,3
  429.  
  430.  
  431.          push   cs
  432.          pop    ds
  433.          call   palette
  434.          ret
  435. rotate           endp
  436. ────────────────────────────────────────────────────────────────────────────────
  437. fade            proc near
  438.         cmp     fadecount,3fh        ; ∙ stop fading
  439.         jae     @skip
  440.  
  441.         mov     si,offset vga_palette
  442.         mov     dx,03c8h                 ; ∙ write to PEL port
  443.         mov     al,00h
  444.         out     dx,al
  445.         inc     dx
  446.  
  447.         mov     ah,fadecount
  448.         xor     ah,direction
  449.  
  450.         mov     cx,256
  451. @change:        lodsb
  452.         sub     al,ah
  453.         jnc     $+4
  454.         mov     al,00h
  455.         out     dx,al
  456.         lodsb
  457.         sub     al,ah
  458.         jnc     $+4
  459.         mov     al,00h
  460.         out     dx,al
  461.         lodsb
  462.         sub     al,ah
  463.         jnc     $+4
  464.         mov     al,00h
  465.         out     dx,al
  466.         loop    @change
  467.         inc     fadecount
  468.         mov     ax,1200h        ; ∙ screen on!
  469.         mov     bl,36h
  470.         int     10h
  471.         ret
  472. @skip:          mov     bp,offset go
  473.         mov     bx,4*3
  474.         call    rotate
  475.         ret
  476. fadecount       db      00
  477. direction       db      3fh
  478. fade            endp
  479. ────────────────────────────────────────────────────────────────────────────────
  480. palette         proc near
  481.         mov     si,offset vga_palette
  482.         mov     dx,03c8h         ; ∙ port PEL write mode
  483.         mov     al,00h           ;   at register 00h
  484.         out     dx,al
  485.         inc     dx               ; ∙ port PEL data register
  486.         mov     cx,0100h*3
  487.         rep     outsb            ; ∙ define the selected
  488.         ret                      ;   vga color a 100h times
  489. palette         endp
  490. ────────────────────────────────────────────────────────────────────────────────
  491. waitkey         proc    near
  492.         mov     ah,01
  493.         int     16h
  494.         jnz     @true
  495.         ret
  496. @true:          mov     ah,07
  497.         int     21h
  498.         jmp     bx
  499.         ret                           ; ∙ again a senseless return!
  500. waitkey         endp
  501. ────────────────────────────────────────────────────────────────────────────────
  502. init            proc near
  503.         mov     ax,13h                  ; ∙ set mode
  504.         int    10h
  505.         mov     dx,03c8h         ; ∙ port PEL write mode
  506.         mov     al,00h           ;   at register 00h
  507.         out     dx,al
  508.         inc     dx
  509.         mov     cx,0100h*3
  510. @i1:            out     dx,al
  511.         loop    @i1
  512.         mov     ah,02
  513.         mov     bh,00
  514.         mov     dh,cursor_y
  515.         mov     dl,cursor_x
  516.         int     10h
  517.         ret
  518. cursor_x        db      7
  519. cursor_y        db      2
  520. init            endp
  521. ────────────────────────────────────────────────────────────────────────────────
  522. bitmap_ball     proc    near
  523.         push    cx
  524.         push    ax
  525.         mov     dx,0a000h
  526.         mov     es,dx
  527.         mov     si,offset ball
  528.         xor     di,di
  529.         add     di,55
  530.         mov     dx,ax
  531.         shl     ax,8
  532.         shl     dx,6
  533.         add     ax,dx
  534.         add     di,ax
  535.  
  536.         mov     dx,11
  537. @b1:            mov     cx,11
  538.         rep     movsb
  539.         add     di,320-11
  540.         dec     dx
  541.         jnz     @b1
  542.         pop     ax
  543.         pop     cx
  544.         ret
  545. bitmap_ball     endp
  546. ────────────────────────────────────────────────────────────────────────────────
  547. print           proc near
  548.         mov     bx,9
  549.         mov     cx,26
  550.         mov     si,offset headline
  551. @d1:            push    cx
  552.         lodsb
  553.         mov     ah,09                           ; ∙ print letter
  554.         mov     cx,01
  555.         int     10h
  556.         mov     ah,02                           ; ∙ change cursor
  557.         inc     cursor_x
  558.         mov     dh,cursor_y
  559.         mov     dl,cursor_x
  560.         int     10h
  561.         pop     cx
  562.         loop    @d1
  563.  
  564.         add     cursor_y,2
  565.         mov     si,offset keys
  566.         mov     bx,9
  567.         mov     cx,09                           ; ∙ number of keys
  568. @d2:            push    cx
  569.         mov     cx,32                           ; ∙ length of keys
  570.         mov     cursor_x,10
  571. @d3:            push    cx
  572.         mov     ah,02                           ; ∙ change cursor
  573.         mov     dh,cursor_y
  574.         mov     dl,cursor_x
  575.         int     10h
  576.         inc     cursor_x
  577.         lodsb
  578.         mov     ah,09                           ; ∙ print letter
  579.         mov     cx,01
  580.         int     10h
  581.         pop     cx
  582.         loop    @d3
  583.         add     cursor_y,2
  584.         pop     cx
  585.         loop    @d2
  586.  
  587.         mov     cx,9                            ; ∙ number of keys
  588.         mov     ax,29
  589. @d4:            call    bitmap_ball
  590.         add     ax,16
  591.         loop    @d4
  592.  
  593.         ret                             ;   you can only write here
  594. headline        db      "TRAINER FOR PINBALL DREAMS"
  595. keys            db      "F1  - HELLO WILKINS!            "
  596.         db      "F2  - UNLIMITED BALLS           "
  597.         db      "F3  - REAL MULTI-PLAY           "
  598.         db      "F4  - BONUS OF 1.000            "
  599.         db      "F5  - THE SONG IS NOT           "
  600.         db      "F6  - FINISHED...YOU            "
  601.         db      "F7  - ARE LISTENING TO          "
  602.         db      "F8  - SKAVEN`S TUNE!            "
  603.         db      "F9  - PLASMOID                  "
  604. print           endp
  605. ────────────────────────────────────────────────────────────────────────────────
  606. fade_it         proc    near
  607.         cmp     back,22h
  608.         jne     @f1
  609.         mov     fadecount,00            ; ∙ fade out !
  610.         mov     direction,00
  611. @f1:            mov     cx,3fh
  612. @f2:            push    cx                      ; ∙ fade in!
  613.         mov     cs:counter,00
  614.         call    fade
  615. @f3:            cmp     cs:counter,40
  616.         jb      @f3
  617.         pop     cx
  618.         loop    @f2
  619.         ret
  620. back            db      00
  621. fade_it         endp
  622. ────────────────────────────────────────────────────────────────────────────────
  623. messages    db     " · greetz  mister ed · tronics · rooster · kluth · "
  624. ────────────────────────────────────────────────────────────────────────────────
  625. shadow          proc near
  626.         mov     si,32*320+80
  627.         mov     dx,17
  628.         mov     bp,32*320+80
  629. @s1:            mov     ax,0a000h
  630.         mov     ds,ax
  631.         mov     ax,08000h
  632.         mov     es,ax
  633.         xor     di,di
  634.         mov     bx,08
  635. @s2:            mov     cx,110
  636.         rep     movsw
  637.         add     si,100
  638.         dec     bx
  639.         jnz     @s2
  640.  
  641.         xor     di,di
  642.         mov     al,09
  643.         mov     bx,09
  644. @s3:            mov     cx,220
  645. @s4:            repne   scasb
  646.         cmp     cx,00
  647.         je      @s5
  648.         dec     di
  649. @@1:            cmp     cs:status,00
  650.         jne     @@2
  651.         mov  byte ptr es:[di],0Ah
  652.         inc     cs:status
  653.         jmp     @cont
  654.  
  655. @@2:            cmp     cs:status,01
  656.         jne     @@3
  657.         mov  byte ptr es:[di],0Bh
  658.         inc     cs:status
  659.         jmp     @cont
  660.  
  661. @@3:            cmp     cs:status,02
  662.         jne     @@4
  663.         mov  byte ptr es:[di],0Ch
  664.         inc     cs:status
  665.         jmp     @cont
  666.  
  667. @@4:            cmp     cs:status,03
  668.         jne     @@1
  669.         mov  byte ptr es:[di],0Dh
  670.         mov     cs:status,00
  671.         jmp     @cont
  672.  
  673. @cont:          jmp     @s4
  674. @s5:            dec     di
  675.         dec     bx
  676.         jnz     @s3
  677.  
  678.         push    es
  679.         push    ds
  680.         pop     es
  681.         pop     ds
  682.         mov     di,bp
  683.         sub     di,321
  684.         xor     si,si
  685.         mov     bx,08
  686. @s6:            mov     cx,220
  687. @s7:            cmp byte ptr ds:[si],00
  688.         je      @s8
  689.         movsb
  690.         dec     cx
  691.         jmp     @s9
  692. @s8:            inc     di
  693.         inc     si
  694.         dec     cx
  695. @s9:            cmp     cx,00
  696.         jnz     @s7
  697.         add     di,100
  698.         dec     bx
  699.         jnz     @s6
  700.  
  701.         add     bp,8*320
  702.         mov     si,bp
  703.         dec     dx
  704.         jz      @s10
  705.         jmp     @s1
  706. @s10:           push    cs
  707.         pop     ds
  708.         ret
  709. status          db      00
  710. shadow          endp
  711. ────────────────────────────────────────────────────────────────────────────────
  712. double          proc    near
  713.         mov     dx,0a000h
  714.         mov     ds,dx
  715.         mov     si,320*16
  716.         mov     dx,08000h
  717.         mov     es,dx
  718.         xor     di,di
  719.         mov     cx,320*8/2
  720.         rep     movsw
  721.  
  722.         xor     di,di
  723.         mov     al,09
  724.         mov     cx,320*8
  725. @1:             repne   scasb
  726.         cmp     cx,00
  727.         je      @2
  728.         dec     di
  729.         inc     cx
  730.         mov byte ptr es:[di],17
  731.         jmp     @1
  732.  
  733. @2:             push    ds
  734.         push    es
  735.         pop     ds
  736.         pop     es
  737.         mov     di,320*15-1
  738.         xor     si,si
  739.         mov     cx,320*8
  740. @new:           cmp byte ptr ds:[si],00
  741.         je      @5
  742.         movsb
  743.         dec     cx
  744.         jmp     @new
  745. @5:             inc     di
  746.         inc     si
  747.         dec     cx
  748.         cmp     cx,00
  749.         jnz     @new
  750.  
  751.         mov     di,320*14-1
  752.         xor     si,si
  753.         mov     cx,320*8
  754. @newer:         cmp byte ptr ds:[si],00
  755.         je      @6
  756.         mov     al,ds:[si]
  757.         inc     al
  758.         mov     es:[di],al
  759. @6:             inc     di
  760.         inc     si
  761.         dec     cx
  762.         cmp     cx,00
  763.         jnz     @newer
  764.  
  765.         push    cs
  766.         pop     ds
  767.         ret
  768. scount          db      00
  769. double          endp
  770. ────────────────────────────────────────────────────────────────────────────────
  771. ball      db 000h,000h,000h,002h,002h,002h,003h,002h,000h,000h,000h
  772.      db 000h,000h,002h,002h,003h,003h,003h,003h,003h,000h,000h
  773.      db 000h,002h,002h,007h,003h,003h,003h,004h,004h,003h,000h
  774.      db 002h,002h,007h,008h,007h,003h,004h,004h,004h,004h,002h
  775.      db 002h,003h,003h,007h,003h,004h,004h,006h,005h,004h,003h
  776.      db 002h,003h,003h,003h,004h,004h,005h,006h,006h,004h,003h
  777.      db 002h,003h,003h,004h,004h,005h,007h,006h,005h,004h,003h
  778.      db 002h,003h,004h,004h,006h,006h,006h,006h,004h,003h,002h
  779.      db 000h,003h,003h,005h,005h,006h,005h,004h,004h,002h,000h
  780.      db 000h,000h,003h,003h,004h,004h,004h,003h,002h,000h,000h
  781.      db 000h,000h,000h,002h,003h,003h,003h,002h,000h,000h,000h
  782.  
  783. vga_palette     db 000h, 000h, 000h                 ; ∙ colors of the ball
  784.         db 000h, 000h, 0003h
  785.         db 016h-0dh, 000h, 011h-00h
  786.         db 019h-0ch, 000h, 019h-0ch
  787.         db 01ch-0bh, 000h, 01ch-0bh
  788.         db 020h-0ah, 000h, 020h-0ah
  789.         db 024h-0ah, 000h, 024h-0ah
  790.         db 028h-0ah, 000h, 028h-0ah
  791.         db 02fh, 02fh, 02fh
  792.         db 000h, 010h, 012h        ; 9
  793. go:             db 000h, 01fh, 01fh        ; 10
  794.         db 000h, 022h, 022h        ; 11
  795.         db 000h, 024h, 024h        ; 12
  796.         db 000h, 026h, 026h        ; 13
  797.         db 000h, 024h, 024h        ; 14
  798.         db 000h, 022h, 022h        ; 15
  799.         db 000h, 022h, 022h        ; 16
  800.         db 02dh, 000h, 02dh
  801.         db 024h, 000h, 024h
  802. shady           db 000h,000h,000h          ; ∙ ground   19
  803.         db 000h,000h,001h
  804.         db 000h,000h,002h
  805.         db 000h,000h,003h
  806.         db 000h,000h,004h
  807.         db 000h,000h,005h
  808.         db 000h,000h,006h
  809.         db 000h,000h,007h
  810.         db 000h,000h,008h          ; ∙ shades
  811.         db 000h,000h,009h
  812.         db 000h,000h,00ah
  813.         db 000h,000h,00bh
  814.         db 000h,000h,00ch
  815.         db 000h,000h,00dh
  816.         db 000h,000h,00eh
  817.         db 000h,000h,00fh
  818.         db 000h,000h,010h             ; ∙ shades
  819.         db 001h,000h,011h
  820.         db 002h,000h,012h
  821.         db 003h,000h,013h
  822.         db 004h,000h,014h
  823.         db 005h,000h,015h
  824.         db 006h,000h,016h
  825.         db 007h,000h,015h
  826.         db 008h,000h,016h
  827.         db 009h,000h,017h
  828.         db 00ah,000h,018h
  829.         db 00bh,000h,019h
  830.         db 00ch,000h,01ah
  831.         db 00dh,000h,01bh
  832.         db 00eh,000h,01ch
  833.         db 00fh,000h,01dh
  834. ───────────────────────────────────────────────────────────────────────────────
  835. ;adlib player data by future crew
  836. a_inst_table    label byte
  837.         db 20h+0,20h+1,20h+2,20h+8,20h+9,20h+10,20h+16,20h+17,20h+18
  838. NTB             equ 8192 ;+1024*1
  839. a_note_table    label word
  840.         dw NTB+363,NTB+385,NTB+408,NTB+432,NTB+458,NTB+485
  841.         dw NTB+514,NTB+544,NTB+577,NTB+611,NTB+647,NTB+868
  842.         dw 00
  843. ────────────────────────────────────────────────────────────────────────────────
  844. ;adlib tune by plasmoid (not now!, it's still skaven's tune)
  845. ;music_channels equ 8
  846. ;music_speed equ 8
  847. ;music_instruments LABEL BYTE
  848. ;dw OFFSET ains6
  849. ;dw OFFSET ains2
  850. ;dw OFFSET ains4
  851. ;dw OFFSET ains3
  852. ;dw OFFSET ains3
  853. ;dw OFFSET ains1
  854. ;dw OFFSET ains1
  855. ;dw OFFSET ains4
  856. ;ains1 LABEL BYTE
  857. ;db 65,194,6,0,35,242,240,240,1,0,4
  858. ;ains2 LABEL BYTE
  859. ;db 145,64,135,128,243,111,35,3,1,1,2
  860. ;ains3 LABEL BYTE
  861. ;db 225,33,17,128,17,19,34,34,0,0,12
  862. ;ains4 LABEL BYTE
  863. ;db 97,33,27,0,98,132,86,85,0,0,14
  864. ;ains6 LABEL BYTE
  865. ;db 145,64,135,136,243,111,35,3,1,1,2
  866. ;music_patterns LABEL BYTE
  867. ;ach0 dw OFFSET ach0d,OFFSET ach0dr
  868. ;ach1 dw OFFSET ach1d,OFFSET ach1dr
  869. ;ach2 dw OFFSET ach2d,OFFSET ach2dr
  870. ;ach3 dw OFFSET ach3d,OFFSET ach3d
  871. ;ach4 dw OFFSET ach4d,OFFSET ach4d
  872. ;ach5 dw OFFSET ach5d,OFFSET ach5d
  873. ;ach6 dw OFFSET ach6d,OFFSET ach6d
  874. ;ach7 dw OFFSET ach7d,OFFSET ach7d
  875. ;ach0d LABEL BYTE
  876. ;db 081h
  877. ;ach0dr LABEL BYTE
  878. ;db 057h,050h,050h,055h,057h,050h,055h,057h
  879. ;db 050h,055h,057h,050h,055h,057h,050h,055h
  880. ;db 0
  881. ;ach1d LABEL BYTE
  882. ;db 081h
  883. ;ach1dr LABEL BYTE
  884. ;db 050h,055h,057h,050h,055h,057h,050h,055h
  885. ;db 057h,050h,055h,057h,050h,055h,057h,050h
  886. ;db 0
  887. ;ach2d LABEL BYTE
  888. ;db 0C0h,050h,084h
  889. ;db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
  890. ;db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
  891. ;ach2dr LABEL BYTE
  892. ;db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
  893. ;db 025h,015h,025h,015h,028h,018h,02Ah,01Ah
  894. ;db 0
  895. ;ach3d LABEL BYTE
  896. ;db 0A0h,050h,040h,0C0h,040h,088h,040h,040h
  897. ;db 03Ah,042h,090h,045h,088h,040h,042h,040h
  898. ;db 047h,090h,04Ah,088h,045h,098h,040h
  899. ;db 0
  900. ;ach4d LABEL BYTE
  901. ;db 0A0h,050h,030h,0C0h,047h,088h,047h,043h
  902. ;db 042h,045h,047h,045h,048h,047h,047h,050h
  903. ;db 052h,084h,050h,04Ah,088h,050h,098h,045h
  904. ;db 0
  905. ;ach5d LABEL BYTE
  906. ;db 0C0h,020h,0A0h,010h,010h,090h,010h,02Ah
  907. ;db 025h,088h,028h,02Ah,090h,010h,02Ah,025h
  908. ;db 088h,028h,02Ah
  909. ;db 0
  910. ;ach6d LABEL BYTE
  911. ;db 0C0h,020h,0A0h,020h,020h,090h,020h,01Ah
  912. ;db 015h,088h,018h,01Ah,090h,020h,01Ah,015h
  913. ;db 088h,018h,01Ah
  914. ;db 0
  915. ;ach7d LABEL BYTE
  916. ;db 0C0h,00Ch,0FEh,050h,090h,00Ch,081h,04Ah
  917. ;db 050h,084h,052h,055h,086h,04Ah,081h,050h
  918. ;db 04Ah,086h,050h,082h,055h,098h,045h
  919. ;db 0
  920.  
  921.  
  922. music_channels  equ 8
  923. music_speed     equ 8
  924. music_instruments label byte
  925.                dw offset ains1         ; synthy·strings
  926.                dw offset ains1         ; synthy·strings
  927.                dw offset ains1         ; synthy·strings
  928.                dw offset ains2         ; octaved·string
  929.                dw offset ains3         ; woaw·synth·lead
  930.                dw offset ains3         ; woaw·synth·lead
  931.                dw offset ains4         ; electric·piano
  932.                dw offset ains5         ; hihat·snaredrum
  933.  
  934. ains1           label byte
  935.                db 0e1h,021h,011h,080h,011h,013h,022h,022h,000h,000h,00ch
  936. ains2           label byte
  937.                db 001h,005h,085h,040h,0f7h,0f3h,013h,0f2h,001h,000h,00ah
  938. ains3           label byte
  939.                db 041h,0c2h,006h,000h,023h,0f2h,0f0h,0f0h,001h,000h,004h
  940. ains4           label byte
  941.                db 041h,0c1h,009h,003h,0ffh,0f3h,060h,0f0h,002h,000h,008h
  942. ains5           label byte
  943.                db 030h,01eh,003h,000h,0f6h,0f2h,065h,007h,000h,003h,006h
  944.  
  945. music_patterns  label byte
  946. ach1            dw offset ach0d
  947. ach0            dw offset ach1d,offset ach1dr
  948. ach2            dw offset ach2d,offset ach2dr
  949. ach3            dw offset ach3d,offset ach3d
  950. ach4            dw offset ach4d,offset ach4d
  951. ach5            dw offset ach5d,offset ach5d
  952. ach6            dw offset ach6d,offset ach6d
  953. ach7            dw offset ach7d,offset ach7d
  954.  
  955. ach0d           label byte
  956.                db  30h,32h,34h,35h,37h,39h,3bh,3ch,3dh,3eh,3fh,00h
  957.  
  958. ach1d           label byte
  959.                db 081h
  960. ach1dr          label byte
  961.                db 050h,055h,057h,050h,055h,057h,050h,055h
  962.                db 057h,050h,055h,057h,050h,055h,057h,050h
  963.                db 0
  964. ach2d           label byte
  965.                db 0C0h,050h,084h
  966.                db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
  967.                db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
  968. ach2dr          label byte
  969.                db 030h,020h,030h,020h,02Ah,01Ah,02Ah,01Ah
  970.                db 025h,015h,025h,015h,028h,018h,02Ah,01Ah
  971.                db 0
  972. ach3d           label byte
  973.                db 0A0h,050h,040h,0C0h,040h,088h,040h,040h
  974.                db 03Ah,042h,090h,045h,088h,040h,042h,040h
  975.                db 047h,090h,04Ah,088h,045h,098h,040h
  976.                db 0
  977. ach4d           label byte
  978.                db 0A0h,050h,030h,0C0h,047h,088h,047h,043h
  979.                db 042h,045h,047h,045h,048h,047h,047h,050h
  980.                db 052h,084h,050h,04Ah,088h,050h,098h,045h
  981.                db 0
  982. ach5d           label byte
  983.                db 0C0h,020h,0A0h,010h,010h,090h,010h,02Ah
  984.                db 025h,088h,028h,02Ah,090h,010h,02Ah,025h
  985.                db 088h,028h,02Ah
  986.                db 0
  987. ach6d           label byte
  988.                db 0C0h,020h,0A0h,020h,020h,090h,020h,01Ah
  989.                db 015h,088h,018h,01Ah,090h,020h,01Ah,015h
  990.                db 088h,018h,01Ah
  991.                db 0
  992. ach7d           label byte
  993.                db 0C0h,00Ch,0FEh,050h,090h,00Ch,081h,04Ah
  994.                db 050h,084h,052h,055h,086h,04Ah,081h,050h
  995.                db 04Ah,086h,050h,082h,055h,098h,045h
  996.                db 0
  997. ────────────────────────────────────────────────────────────────────────────────
  998. ;adlib data used by player
  999. a_musiccnt      dw 0
  1000. a_chdelaycnt    db 9 dup(0)
  1001. a_chdelay       db 9 dup(0)
  1002. ────────────────────────────────────────────────────────────────────────────────
  1003. main:           call    a_init                  ; ∙ adlib on
  1004.         call    init_timer              ; ∙ timer on
  1005.         call    init                    ; ∙ init screen, etc.
  1006.         call    print                   ; ∙ draw things
  1007.         call    shadow                  ; ∙ create shadow
  1008.         call    double                  ; ∙ double shadow
  1009.         call    fill                    ; ∙ fill screen
  1010.         call    fade_it            ; ∙ fade in
  1011.  
  1012. @3:             mov     cs:counter,00
  1013.         cmp     intern,7                ; ∙ new frequency
  1014.         jb      @no_fade                ;   7*10 = 70/1000 sec
  1015.         call    fade                    ; ∙ rotate colors
  1016.         mov byte ptr intern,00
  1017. @no_fade:       inc byte ptr intern
  1018.         call    shades                  ; ∙ shades!
  1019. @4:             cmp     cs:counter,10           ; ∙ wait 10/1000 sec
  1020.         jb      @4
  1021.         mov     bx,offset exit
  1022.         call    waitkey                 ; ∙ jmp exit if key
  1023.         jmp     @3
  1024. exit:           mov     back,22h
  1025.         call    fade_it                 ; ∙ fade out
  1026.         call    kill_timer              ; ∙ timer off
  1027.         call    a_init                  ; ∙ adlib off
  1028.         mov    ax,0003h
  1029.         int    21h
  1030.         mov     ax,4c00h                ; ∙ see you soon!
  1031.         int     21h
  1032. intern          db      00
  1033. code            ends
  1034. end             trainer
  1035.